<div class="indent">
    <div class="heading_title">
        <h1>Add/Edit UserType</h1>                
    </div>	
</div> 
 
<form name="formusertype" action="" method="post">       
<!-- main indent-->
<div class="indent-center">

    <div class="btncontrol">
        <div class="fright">
            <input class="btn" type="submit"  value="<?php echo $this->document->text['button_save']?>" name="save" />
            <input class="btn" type="button"  value="<?php echo $this->document->text['button_cancel']?>"  onclick="linkto('?route=core/usertype')" />            
        </div>
        <div class="clear"></div>
    </div>
    <div class="editform usertype-form">
    
        <table class="tbl" cellpadding="0" cellspacing="0" border="1">
            <tr>
                <td class="tdleft" width="30%">User Type</td>
                <td class="tdright" width="70%">
                	<input name="usertypename" class="txtext" type="text" value="<?php echo $UserType['usertypename']?><?php echo $cache['usertypename']?>" />
                    <input type="hidden" name="usertypeid" value="<?php echo $UserType['usertypeid']?>" />
					<i><?php echo $require?></i>&nbsp;<br />
					<i><?php echo $unique?></i>
                </td>
            </tr>
            <tr>
                <td class="tdleft" width="30%">Parent</td>
                <td class="tdright" width="70%">
                	<select name="UserTypeParent" style="<?php echo $showParent?>">
                    	<option value="0" >Root</option>
<?php
	foreach($usertypes as $item)
    {
?>
						<option value="<?php echo $item['usertypeid']?>" <?php echo $item['Selected']?> ><?php echo $item['Prefix']?><?php echo $item['usertypename']?></option>
<?php
    }
?>
                    </select>
                    <?php echo $parentname?>
                </td>
            </tr>      
        </table>  
        <?php echo $Error?>
        
       
    </div>
    
    <div class="editform">
        <table cellspacing="0" cellpadding="0" border="1" class="tbl">
            <thead>
            	<th colspan="2"><h1>PERMISSION</h1></th>
            </thead>
            <tbody>
            	<tr>
                	<td width="20%" class="tdleft" style="text-align:center">Module</td>
                    <td width="80%" class="tdleft" style="text-align:center">Workflows</td>
                </tr>
                
                <?php foreach($modules as $module) { ?>
                <tr>
                	<td width="20%" style="text-align:left"><strong><?php echo $module['modulename']?></strong></td>
                    <td width="80%" style="text-align:left">
                    	<!--List Permission-->
                        <p>
                        	<h1>PERMISSION</h1>
                        
                            <span class="panel">
                            <?php foreach($module['permissions'] as $permission) { ?>
                            
                                <label>
                                    <input type="checkbox" class="inputchk" name="permission<?php echo $module['moduleid']?>[<?php echo $permission[0]?>]" value="<?php echo $permission[0]?>" <?php echo $permission[1]?> />
                                    <?php echo $permission[0]?>
                                </label>
                                
                            <?php } ?>
                            </span>
                            
                            <label class="button"><a onclick="$('input[name*=\'permission<?php echo $module['moduleid']?>\']').attr('checked', true);">Check all</a>|<a onclick="$('input[name*=\'permission<?php echo $module['moduleid']?>\']').attr('checked', false);">UnCheck</a></label>
                        </p>
                        <!--List Sitemap-->
                        <p>
                        	<h1>SITEMAP</h1>
                            <label class="button"><a onclick="$('input[name*=\'sitemap<?php echo $module['moduleid']?>\']').attr('checked', true);">Check all</a>|<a onclick="$('input[name*=\'sitemap<?php echo $module['moduleid']?>\']').attr('checked', false);">UnCheck</a></label><br/>
                            <?php foreach($module['Sitemaps'] as $sitemap) { ?>
                           
                            	<label class="sitemap_item"><input type="checkbox" class="inputchk" name="sitemap<?php echo $module['moduleid']?>['<?php echo $sitemap[0]['sitemapid']?>']" value="<?php echo $sitemap[0]['sitemapid']?>" <?php echo $sitemap[1]?> /><?php echo $sitemap[0]['sitemapname']?></label>
                            <?php } ?>
                        </p>
                        
                    
                    </td>
                </tr>
                <?php } ?>
            </tbody>
        </table>
    </div>
</div>
</form> 
<!-- main indent end-->  
